import { VxeRadio, VxeRadioGroup } from 'vxe-table';
import { defineComponent } from 'vue';

export default defineComponent({
  props: {
    modelValue: {
      type: Date,
      dafault: null,
    },
    options: {
      type: Array,
      default: null,
    },
  },
  emits: ['update:modelValue', 'change'],
  setup(props, { emit, slots }) {
    const onChange = ({ label }) => {
      emit('update:modelValue', label);
      emit('change', label);
    };
    return () => {
      return (
        <VxeRadioGroup model-value={props.modelValue} onChange={onChange}>
          {props.options.length > 0 && (
            <div>
              {props.options.map((item: any) => {
                return (
                  <VxeRadio label={item.value} content={item.label}></VxeRadio>
                );
              })}
            </div>
          )}
        </VxeRadioGroup>
      );
    };
  },
});
